package com.huidao.servlet.goodsType;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huidao.entity.GoodsType;
import com.huidao.service.GoodsTypeService;
import com.huidao.service.GoodsTypeServiceImp;


public class UpdateGoodsTypeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public UpdateGoodsTypeServlet() {
    }


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		GoodsTypeService gs = new GoodsTypeServiceImp();
		GoodsType gt = new GoodsType();
		gt.setGoodstype_name(request.getParameter("gtypename"));
		gt.setGoodstype_id(Long.parseLong(request.getParameter("id")));
		String data = gs.updateGoodsType(gt);
		if(data.equals("")){
			request.getRequestDispatcher("GetListGoodsType").forward(request, response);
		}else{
			response.getWriter().print(data);
		}
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}

}
